<!DOCTYPE html>
<html>
<head>
<title>用户红包管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../include/resources.html">

<script type="text/javascript">
    var dataGrid;
    var winWidth =  700; //弹出窗口宽度
    var winHeight = 500; //弹出窗口高度
    var addTitle = "添加加息券"; //添加窗口标题
    var addUrl =  "/coupon/append.html?category=1"; // 添加窗口链接地址
    var editTitle = "编辑加息券"; //编辑窗口标题
    var editUrl =  "/coupon/modify.html?category=1"; //编辑窗口链接地址
    //var sendUrl = =  "/modules/user/redPacket/sendGiving.html"; //发放红包链接
    
    var deleteUrl = "/modules/user/redPacket/delGiving.html";   //启用或禁用操作员地址
    $(function() {
        dataGrid = $('#dataGrid').datagrid({
            url : 'doBrowser.html?category=1',
            fit : true,
            fitColumns : true,
            border : false,
            pagination : true,
            idField : 'id',
            pageSize : pageSize,
            pageNums :1,
            pageList : pageList,
            sortName : 'id',
            sortOrder : 'asc',
            checkOnSelect : false,
            selectOnCheck : false,
            nowrap : false,
            singleSelect:true,
            columns : [ [
            { field: 'id', title: '编号', width: 50, checkbox : false},
            { field: 'name', title: '名称', width: 100, checkbox : false},
            { field: 'code', title: '类别', width: 100, checkbox : false, 
                formatter: function(value,row,index){
                    if (value==1){
                        return "用户注册";
                    }else if(value==2){
                        return "实名认证";
                    }else{
                    	return "";
                    }
                } },
            { field: 'lifecycle', title: '有效期', width: 100, sortable: false},
            { field: 'putStartTime', title: '开始时间', width: 100, sortable: false, 
                        formatter: function(value,row,index){
                            return getLocalTime(value,4);
                        }  
                    },
            { field: 'putEndTime', title: '结束时间', width: 150, sortable:false, 
                        formatter: function(value,row,index){
                            return getLocalTime(value,4);
                        }  
                    },
            { field: 'denomination', title: '加息比例', width: 50, sortable: false},
            { field: 'status', title: '状态', width: 50, sortable: false, 
                        formatter: function(value,row,index){
                            if (value==1){
                                return "启用";
                            }else if(value==2){
                                return "停用";
                            }else{
                             return "未知";
                            }
                            
                        }  
                    },
            {   field : 'action',
                title : '操作',
                width :75,
                fixed: true,
                align:'center',
                formatter : function(value, row, index) { //功能按钮添加
                    var str = '';
                    str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
                    return str;
                }
            }
             ] ],
            toolbar : '#toolbar',
            onLoadSuccess : function() {
                $('#searchForm table').show();
                parent.$.messager.progress('close');
            }
        });
    });
</script>
</head>
<body style="padding:0 20px;" >
    <div class="easyui-layout" data-options="fit : true,border : false">
        <div data-options="region:'north',border:false,collapsible:false" id="searchBox">
            <div class="sLeft">
                <form id="searchForm">
                    <input type="text"  name="name" class="sInput" placeholder="输入加息券名称进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
                </form>
            </div>
            <div class="sRight">
                <a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加加息券</a>     
            </div>
        </div>
        <div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
            <table id="dataGrid"></table>
        </div>
    </div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>